* Table A.4: Relationship between relative age at election t0 and turnout by election

use  "Data_temp/turnout.dta", clear

replace voted=. if age0<-24

* 1983
estimates clear
rdrobust voted age2 if election==1992 & age2!=0, p(1) h(24)
		est sto m1
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)
rdrobust voted age3 if election==1997 & age3!=0, p(1) h(24)
		est sto m2
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)
		
estout m* using "Tables/a_tb4.tex", ///
	style(tex) cells (b(star fmt(%9.3f)) se(par fmt(%9.3f)))  ///
	starlevels( * 0.1 ** 0.05 *** 0.01)  varlabels(RD_Estimate "\hline \\ \\ RD estimate election 1983")	  ///
	stats(eff_obs, fmt(%9.0gc) labels("\hline N"))    mlabels(none	) ///
	collabels(none) eql(none) notype label replace		extracol(1 1)			

* 1987
// election 0
// rdrobust voted age0 if election==1987 & age0!=0, p(1) h(24) 
estimates clear
rdrobust voted age1 if election==1992 & age1!=0, p(1) h(24)
		est sto m1
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)
rdrobust voted age2 if election==1997 & age2!=0, p(1) h(24)
		est sto m2
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)
rdrobust voted age3 if election==2001 & age3!=0, p(1) h(24)
		est sto m3
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)

		
estout m* using "Tables/a_tb4.tex", ///
	style(tex) cells (b(star fmt(%9.3f)) se(par fmt(%9.3f)))  ///
	starlevels( * 0.1 ** 0.05 *** 0.01)  varlabels(RD_Estimate "\hline \\ \\ RD estimate election 1987")	  ///
	stats(eff_obs, fmt(%9.0gc) labels("\hline N"))    mlabels(none	) ///
	collabels(none) eql(none) notype label append		extracol(1)	
		

* 1992
estimates clear

rdrobust voted age0 if election==1992 & age0!=0, p(1) h(24) 
		est sto m0
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)
rdrobust voted age1 if election==1997 & age1!=0, p(1) h(24)
		est sto m1
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)
rdrobust voted age2 if election==2001 & age2!=0, p(1) h(24)
		est sto m2
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)
rdrobust voted age3 if election==2005 & age3!=0, p(1) h(24)
		est sto m3
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)


estout m* using "Tables/a_tb4.tex", ///
	style(tex) cells (b(star fmt(%9.3f)) se(par fmt(%9.3f)))  ///
	starlevels( * 0.1 ** 0.05 *** 0.01)  varlabels(RD_Estimate "\hline \\ \\ RD estimate election 1992")	  ///
	stats(eff_obs, fmt(%9.0gc) labels("\hline N"))    mlabels(none	) ///
	collabels(none) eql(none) notype label append	

* 1997
estimates clear

rdrobust voted age0 if election==1997 & age0!=0, p(1) h(24) 
		est sto m0
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)
rdrobust voted age1 if election==2001 & age1!=0, p(1) h(24)
		est sto m1
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)
rdrobust voted age2 if election==2005 & age2!=0, p(1) h(24)
		est sto m2
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)
rdrobust voted age3 if election==2010 & age3!=0, p(1) h(24)
		est sto m3
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)


estout m* using "Tables/a_tb4.tex", ///
	style(tex) cells (b(star fmt(%9.3f)) se(par fmt(%9.3f)))  ///
	starlevels( * 0.1 ** 0.05 *** 0.01)  varlabels(RD_Estimate "\hline \\ \\ RD estimate election 1997")	  ///
	stats(eff_obs, fmt(%9.0gc) labels("\hline N"))    mlabels(none	) ///
	collabels(none) eql(none) notype label append	

* 2001
estimates clear

rdrobust voted age0 if election==2001 & age0!=0, p(1) h(24) 
		est sto m0
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)
rdrobust voted age1 if election==2005 & age1!=0, p(1) h(24)
		est sto m1
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)
rdrobust voted age2 if election==2010 & age2!=0, p(1) h(24)
		est sto m2
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)
rdrobust voted age3 if election==2015 & age3!=0, p(1) h(24)
		est sto m3
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)


estout m* using "Tables/a_tb4.tex", ///
	style(tex) cells (b(star fmt(%9.3f)) se(par fmt(%9.3f)))  ///
	starlevels( * 0.1 ** 0.05 *** 0.01)  varlabels(RD_Estimate "\hline \\ \\ RD estimate election 2001")	  ///
	stats(eff_obs, fmt(%9.0gc) labels("\hline N"))    mlabels(none	) ///
	collabels(none) eql(none) notype label append	

* 2005
estimates clear

rdrobust voted age0 if election==2005 & age0!=0, p(1) h(24) 
		est sto m0
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)
rdrobust voted age1 if election==2010 & age1!=0, p(1) h(24)
		est sto m2
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)
rdrobust voted age2 if election==2015 & age2!=0, p(1) h(24)
		est sto m3
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)
rdrobust voted age3 if election==2017 & age3!=0, p(1) h(24)
		est sto m4
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)


estout m* using "Tables/a_tb4.tex", ///
	style(tex) cells (b(star fmt(%9.3f)) se(par fmt(%9.3f)))  ///
	starlevels( * 0.1 ** 0.05 *** 0.01)  varlabels(RD_Estimate "\hline \\ \\ RD estimate election 2005")	  ///
	stats(eff_obs, fmt(%9.0gc) labels("\hline N"))    mlabels(none	) ///
	collabels(none) eql(none) notype label append	

* 2010
estimates clear

rdrobust voted age0 if election==2010 & age0!=0, p(1) h(24) 
		est sto m0
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)
rdrobust voted age1 if election==2015 & age1!=0, p(1) h(24)
		est sto m1
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)
rdrobust voted age2 if election==2017 & age2!=0, p(1) h(24)
		est sto m2
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)

estout m* using "Tables/a_tb4.tex", ///
	style(tex) cells (b(star fmt(%9.3f)) se(par fmt(%9.3f)))  ///
	starlevels( * 0.1 ** 0.05 *** 0.01)  varlabels(RD_Estimate "\hline \\ \\ RD estimate election 2010")	  ///
	stats(eff_obs, fmt(%9.0gc) labels("\hline N"))    mlabels(none	) ///
	collabels(none) eql(none) notype label append	
	

* 2015
estimates clear

rdrobust voted age0 if election==2015 & age0!=0, p(1) h(24) 
		est sto m0
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)
rdrobust voted age1 if election==2010 & age1!=0, p(1) h(24)
		est sto m1
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)

estout m* using "Tables/a_tb4.tex", ///
	style(tex) cells (b(star fmt(%9.3f)) se(par fmt(%9.3f)))  ///
	starlevels( * 0.1 ** 0.05 *** 0.01)  varlabels(RD_Estimate "\hline \\ \\ RD estimate election 2015")	  ///
	stats(eff_obs, fmt(%9.0gc) labels("\hline N"))    mlabels(none	) ///
	collabels(none) eql(none) notype label append		

* 2017
estimates clear

rdrobust voted age0 if election==2017 & age0!=0, p(1) h(24) 
		est sto m0
		estadd scalar  eff_obs=e(N_b_l)+e(N_b_r)

estout m* using "Tables/a_tb4.tex", ///
	style(tex) cells (b(star fmt(%9.3f)) se(par fmt(%9.3f)))  ///
	starlevels( * 0.1 ** 0.05 *** 0.01)  varlabels(RD_Estimate "\hline \\ \\ RD estimate election 2017")	  ///
	stats(eff_obs, fmt(%9.0gc) labels("\hline N"))    mlabels(none	) ///
	collabels(none) eql(none) notype label append			

